Dynomotion

Group: DynoMotion Message: 15076 From: tmday7 Date: 10/14/2017
Subject: Soft Limits With Switches
Hello,
 Just now getting back to soft limit setup on my mill. Tryed this early on when i was configuring my pendant and was getting a runaway condition when a soft limit was triggered. Now that mill has been tested for a while without any issues, i am trying to get soft limits to work.

Running KMotion CNC 4.34J.
 There is a + and - limit switch(Proximity Sensor) on each axis and each switch having its own bit from the Konnect board.
Current limit switch option is set to Watch Limit and bit numbers set , Positive Soft limit of 1000 and minus soft limit at 40000 , with action of Stop Movement.

When i try to run my Reference axis c code program, axes goes into feed hold. I also get a feed hold when trying to execute a G53 G00 X0 Y0 Z0. I understand the feed hold is the action that will happen with Soft Limits and Stop Movement enabled. But why is this action valid when running my Reference C code program or executing a G53? Shouldn't it be ignored when doing these 2 commands?

Thanks,
Troy


Group: DynoMotion Message: 15077 From: Tom Kerekes Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

Was that a typo?  The positive Soft Limit should be more positive than the negative Soft Limit.

But you will need to disable Soft Limits whenever you need to move outside the Soft Limits.   To disable Soft Limits set them to large values beyond what you will be moving.  It is usually necessary to disable them while homing and then re-enable them after homing is complete.

HTH
Regards
TK

On 10/14/2017 7:17 AM, tmday88@... [DynoMotion] wrote:
 

Hello,
 Just now getting back to soft limit setup on my mill. Tryed this early on when i was configuring my pendant and was getting a runaway condition when a soft limit was triggered. Now that mill has been tested for a while without any issues, i am trying to get soft limits to work.

Running KMotion CNC 4.34J.
 There is a + and - limit switch(Proximity Sensor) on each axis and each switch having its own bit from the Konnect board.
Current limit switch option is set to Watch Limit and bit numbers set , Positive Soft limit of 1000 and minus soft limit at 40000 , with action of Stop Movement.

When i try to run my Reference axis c code program, axes goes into feed hold. I also get a feed hold when trying to execute a G53 G00 X0 Y0 Z0. I understand the feed hold is the action that will happen with Soft Limits and Stop Movement enabled. But why is this action valid when running my Reference C code program or executing a G53? Shouldn't it be ignored when doing these 2 commands?

Thanks,
Troy



Group: DynoMotion Message: 15078 From: tmday7 Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Tom,
 No typo.
Forgot to say that iam testing soft limits on the X axis only.
My reference program uses the X+ limit switch to reference axis then moves off by .125"
 If i make the Positive soft limit larger than 1000, then axis will be able to travel past the X + limit switch. And if i make the Minus Soft Limit smaller , the table will not travel far enough in the X- direction.

My referencing program does disable limit switches by using ....
ch0->LimitSwitchOptions=0x00000000; // disable limits
So what is the code for setting soft limits beyond switches? For referencing.

Troy
Group: DynoMotion Message: 15079 From: TKSOFT Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

If you zero the machine coordinates near the + limit then the position
at the - limit should be a large negative number (not positive).

To set Soft Limits to virtual infinity code:

ch0->SoftLimitPos=1e+030;
ch0->SoftLimitNeg=-1e+030;

HTH
Regards
TK

On 2017-10-14 11:29, tmday88@... [DynoMotion] wrote:
> Hi Tom,
> No typo.
> Forgot to say that iam testing soft limits on the X axis only.
> My reference program uses the X+ limit switch to reference axis then
> moves off by .125"
> If i make the Positive soft limit larger than 1000, then axis will be
> able to travel past the X + limit switch. And if i make the Minus Soft
> Limit smaller , the table will not travel far enough in the X-
> direction.
>
> My referencing program does disable limit switches by using ....
> ch0->LimitSwitchOptions=0x00000000; // disable limits
> So what is the code for setting soft limits beyond switches? For
> referencing.
>
> Troy
>
>
> Links:
> ------
> [1]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/messages/15078;_ylc=X3oDMTJydW12OXN1BF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAMxNTA3OARzZWMDZnRyBHNsawNycGx5BHN0aW1lAzE1MDgwMDU3NjY-?act=reply&messageNum=15078
> [2]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/newtopic;_ylc=X3oDMTJmYTA2dm5uBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzE1MDgwMDU3NjY-
> [3]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/topics/15076;_ylc=X3oDMTM3anJnZXRiBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAMxNTA3OARzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzE1MDgwMDU3NjYEdHBjSWQDMTUwNzY-
> [4] https://yho.com/1wwmgg
> [5]
> https://groups.yahoo.com/neo/groups/DynoMotion/info;_ylc=X3oDMTJmODZrZTdqBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzE1MDgwMDU3NjY-
> [6]
> https://groups.yahoo.com/neo;_ylc=X3oDMTJlYWZrMmd1BF9TAzk3NDc2NTkwBGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTUwODAwNTc2Ng--
> [7] https://info.yahoo.com/privacy/us/yahoo/groups/details.html
> [8] https://info.yahoo.com/legal/us/yahoo/utos/terms/
Group: DynoMotion Message: 15080 From: tmday7 Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Ok.  Added SoftLimit infinity code to my reference program. And this is what i ended up with for SoftLimits to work on X axis.....
ch0->SoftLimitPos=-3040;
ch0->SoftLimitNeg=-447040;
Both directions needed a minus symbol in order to work.

This works fine when using on screen jog arrows with a tested set jog rate of 120IPM. When i reach a soft limit axis stops and the feedhold is on for a second and then turns off. Need to test at higher feed rate.

There is a couple problems when using pendant hand wheel....

1) If i use my pendant hand wheel and set it on highest rate and spin hand wheel at about 120 to 150IPM into a Soft Limit, axis stops and feed hold is on and stays on until i release the feed hold button on screen. Then i can jog away with pendant. But if i leave feed hold on and spin hand wheel in opposite direction a few times then release feed hold, the axis takes off in that direction at a distance that looks equal to about how many times i turned wheel in that direction.

2) When using hand wheel at highest selected rate and jogging faster than test above, the axis will over shoot the soft limit and hit limit switch. It overshoots by about .200". I say about because it depends on speed of hand wheel.

Does this make sense? Can post a video if needed.

Thanks,
Troy
Group: DynoMotion Message: 15081 From: Tom Kerekes Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

Since machine zero is at the extreme + limit switch that range would make sense.

Regarding:

#1 - If that is a problem we could add a condition in the MPG program to ignore MPG Changes when in feedhold (CS0_StoppingState!=0)

#2 - Soft limits trigger a stop so there is some overshoot depending on speed.  Can you move in Soft Limits by 0.2 inches if that is a problem?  Otherwise there is an example of how the soft limits can be dynamically adjusted - AdjustSoftLimitsTest.c

Regards
TK

On 10/14/2017 1:31 PM, tmday88@... [DynoMotion] wrote:
 

Ok.  Added SoftLimit infinity code to my reference program. And this is what i ended up with for SoftLimits to work on X axis.....
ch0->SoftLimitPos=-3040;
ch0->SoftLimitNeg=-447040;
Both directions needed a minus symbol in order to work.

This works fine when using on screen jog arrows with a tested set jog rate of 120IPM. When i reach a soft limit axis stops and the feedhold is on for a second and then turns off. Need to test at higher feed rate.

There is a couple problems when using pendant hand wheel....

1) If i use my pendant hand wheel and set it on highest rate and spin hand wheel at about 120 to 150IPM into a Soft Limit, axis stops and feed hold is on and stays on until i release the feed hold button on screen. Then i can jog away with pendant. But if i leave feed hold on and spin hand wheel in opposite direction a few times then release feed hold, the axis takes off in that direction at a distance that looks equal to about how many times i turned wheel in that direction.

2) When using hand wheel at highest selected rate and jogging faster than test above, the axis will over shoot the soft limit and hit limit switch. It overshoots by about .200". I say about because it depends on speed of hand wheel.

Does this make sense? Can post a video if needed.

Thanks,
Troy


Group: DynoMotion Message: 15082 From: tmday7 Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Tom,

1)Is the (CS0_StoppingState!=0) condition something that needs added to Kmotion before it can be used in my MPG c program?

2)I really done want to shorten travels any more than i have already, the travels are kind of small anyhow. I looked at the AdjustSoftLimitsTest.c earlier today and wondered how it was used. So would this code be placed in my for ever loop in Main Init program or MPG program?

Thanks,
Troy
Group: DynoMotion Message: 15083 From: Tom Kerekes Date: 10/14/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

Regarding:

#1 - It should just be needed in the MPG C Program.

#2 - The call should be placed in the forever loop in the Init C Program.  Isn't that also where the MPG Program is called?

Regards
TK

On 10/14/2017 4:31 PM, tmday88@... [DynoMotion] wrote:
 

Hi Tom,

1)Is the (CS0_StoppingState!=0) condition something that needs added to Kmotion before it can be used in my MPG c program?

2)I really done want to shorten travels any more than i have already, the travels are kind of small anyhow. I looked at the AdjustSoftLimitsTest.c earlier today and wondered how it was used. So would this code be placed in my for ever loop in Main Init program or MPG program?

Thanks,
Troy


Group: DynoMotion Message: 15084 From: tmday7 Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Tom,
Yes, MPG program is in my main init program. I tried adding code last night but only thing that changed was the axis movement from MPG hand wheel was not as smooth. Not sure where code should be placed in forever loop, so most likely is the problem.

Thanks,
Troy
Group: DynoMotion Message: 15085 From: Tom Kerekes Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

Is your MPG connected to a hardware encoder input or are you using a software counter?  Please post your combined code.

Regards
TK

On 10/15/2017 10:42 AM, tmday88@... [DynoMotion] wrote:
 

Hi Tom,
Yes, MPG program is in my main init program. I tried adding code last night but only thing that changed was the axis movement from MPG hand wheel was not as smooth. Not sure where code should be placed in forever loop, so most likely is the problem.

Thanks,
Troy


Group: DynoMotion Message: 15086 From: tmday7 Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Tom,
Encoder is connected to Konnect. Here is Main init program....
https://groups.yahoo.com/neo/groups/DynoMotion/files/HurcoMill1/

Troy
Group: DynoMotion Message: 15087 From: Tom Kerekes Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

I think you win the prize for most stuff in the forever loop :}

I see the AdjustSoftLimitis.c included but not any calls to the function such as:

        CheckDistToStop(ch0);
        CheckDistToStop(ch1);
        CheckDistToStop(ch2);

So that should not function any differently than before.  Are you saying it does?

With so much in the forever loop it may be necessary to use a hardware encoder input.  Are any available?

Regards
TK



On 10/15/2017 12:26 PM, tmday88@... [DynoMotion] wrote:
 

Hi Tom,
Encoder is connected to Konnect. Here is Main init program....
https://groups.yahoo.com/neo/groups/DynoMotion/files/HurcoMill1/

Troy


Group: DynoMotion Message: 15088 From: tmday7 Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Tom,
 Whats the prize?! ;)

I actually removed everything i tried last night and forgot to remove the define for AdjustSoftLimits. No i dont have another encoder input. Still using Step/Direction so i lose the other encoder inputs.

Maybe the prize i won is a board to expand encoder inputs? :)

Troy
Group: DynoMotion Message: 15089 From: TK A2 Date: 10/15/2017
Subject: Re: Soft Limits With Switches
Hi Troy. 

Heh heh. 

Well I was hoping to see where you added the new code. I'm surprised the additional calculation is such an issue. 

There best solution would be to find a way to utilize a hardware encoder input.  I'm not familiar with all your IO but it looks like you are using only 3 on KFLOP JP7 so one might be available. Also using 3 Step/Dir on JP5 so one Encoder available there. Or the encoders could be mux'ed from JP5 to JP6 to allow 4 there on JP6 (change Konnect to JP4)

Regards
TK

On Oct 15, 2017, at 3:04 PM, tmday88@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

 

Hi Tom,
 Whats the prize?! ;)

I actually removed everything i tried last night and forgot to remove the define for AdjustSoftLimits. No i dont have another encoder input. Still using Step/Direction so i lose the other encoder inputs.

Maybe the prize i won is a board to expand encoder inputs? :)

Troy

Group: DynoMotion Message: 15090 From: tmday7 Date: 10/15/2017
Subject: Re: Soft Limits With Switches
My 4th encoder input is being used by the spindle encoder.

"Or the encoders could be mux'ed from JP5 to JP6 to allow 4 there on JP6 (change Konnect to JP4)"

Not sure i follow this. Are you saying doing this would add 4 more encoder inputs or just move the ones iam using now?Or?

Troy
Group: DynoMotion Message: 15091 From: mmurray70@hotmail.com Date: 10/15/2017
Subject: Re: Soft Limits With Switches
I also had trouble with the adjustsoftlimits code slowing things down. In order to get it to work fast and reliable I ended up taking part of the adjustsoftlimits code and run it in the init forever loop right after the MPG program commanded a move and it all worked perfectly. So MPG commands a move, and the the adjustsoftlimits code immediately checks it. Do a search and you will probably find my post about it. Works great now even without encoder input. 

Set your soft limits a huge distance from end and test plenty of times. I had some kind of bug at one point that was working perfect 90% of time and occasionally would just go right on past soft limit without stopping at all. I think the above is what fixed it. 

Also even now I set my soft limits 0.25 away from the end. The MPG seems to stop perfectly with the adjustsoftlimits code, but jogging from Kmotion CNC overshoots by about 0.100" for me on fast jog. I think this would vary based on your jog rate and acceleration settings, my acceleration isn't extremely high. 
Group: DynoMotion Message: 15093 From: tmday7 Date: 10/16/2017
Subject: Re: Soft Limits With Switches
I added code from murray's program from cnc zone.
http://www.cnczone.com/forums/dynomotion-kflop-kanalog/322184-improved-mpg-program-mpgsmoother-c.html

V4 is my main init code with murray's program additions.
https://groups.yahoo.com/neo/groups/DynoMotion/files/HurcoMill1/

So far i tested as follows...
Use MPG on .01" setting, travel axis into soft limit. Causes a feed hold of KMCNC. With feed hold still on i used MPG to travel in opposite direction then release feed hold and axis makes a hard jerk of maybe a few tho of an inch and KMCNC goes into estop condition because of axis drive error. Kmotion console reports axis following error.

Not sure about murray's settings of #define RATE 1.1 and #define MINTAU 0.12 so i left them how he used them.
Any ideas ?

Thanks,
Troy
Group: DynoMotion Message: 15096 From: mmurray70@hotmail.com Date: 10/16/2017
Subject: Re: Soft Limits With Switches
I modified the MPG program to give a little better performance, thats where the extra variables come from. You dont need to use this version if you dont want to.

If you want to just add the adjustsoftlimits part you should be able to look at my program, and make the same changes to yours. Basically just include adjustsoftlimits.c on the very first line (and make sure its in your folder), and add the checks (CheckDistToStop) in where i added them. I think that was all there was to it. 

When I run into a soft limit with mpg, it stops and feedhold is toggled on the screen, when i clear it i can back off. No major jerks enough to trip following error limit. What is your following error limit?
 
Group: DynoMotion Message: 15097 From: Tom Kerekes Date: 10/16/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

Sorry but I'm somewhat lost and confused so please be patient with me :)

I don't really understand why Mark's changes work for him (or would help you).  Instead of calling the "Checks" every time through the loop, they are only called when there is motion and actually twice per loop whenever there happens to be an MPG transition.  I can't see how not doing "Checks" when the MPG is not used and there is no motion would be of any benefit.  If only MPG motion is to be limited it would probably be better and simpler to simply limit the MPG Target Position to within the soft limits.

It also isn't clear why adding the "Checks" to your forever loop would make your motion Jerky.  I measured the checks to take several hundred microseconds worst case.  I wouldn't expect this to effect the smoothness of the MPG significantly.  I could see how it might cause a runaway if the "wrap" feature is used to allow faster MPG counting.  The "wrap" feature uses prediction calcs to allow missing encoder transitions and to still track position correctly.  For that to work correctly it requires consistent and fast loop timing.

So before we make any fixes I'd like to better understand what is going on.

Ignoring the problem you describe where MPG is moved in Feedhold and it jerks and whatnot.  Does the code you posted allow the MPG to work properly and smoothly before hitting any Soft Limit?

On a somewhat off-topic issue your issues might be exacerbated by high acceleration/low jerk settings of:

    ch0->Vel=270700;
    ch0->Accel=7.5e+06;
    ch0->Jerk=7.7e+06;

The high acceleration setting itself would allow reaching full speed in
270700 / 7.5e6 = 0.036 sec
This is most likely impossible.

The low Jerk setting requires almost a full second for the acceleration to be applied and another full second to be removed.  This most likely unnecessarily slow. 

You might read this:
http://www.dynomotion.com/wiki/index.php?title=Main_Page#Velocity.2C_Acceleration.2C_and_Jerk

Regards
TK


On 10/16/2017 10:04 AM, tmday88@... [DynoMotion] wrote:
 

I added code from murray's program from cnc zone.
http://www.cnczone.com/forums/dynomotion-kflop-kanalog/322184-improved-mpg-program-mpgsmoother-c.html

V4 is my main init code with murray's program additions.
https://groups.yahoo.com/neo/groups/DynoMotion/files/HurcoMill1/

So far i tested as follows...
Use MPG on .01" setting, travel axis into soft limit. Causes a feed hold of KMCNC. With feed hold still on i used MPG to travel in opposite direction then release feed hold and axis makes a hard jerk of maybe a few tho of an inch and KMCNC goes into estop condition because of axis drive error. Kmotion console reports axis following error.

Not sure about murray's settings of #define RATE 1.1 and #define MINTAU 0.12 so i left them how he used them.
Any ideas ?

Thanks,
Troy


Group: DynoMotion Message: 15099 From: tmday7 Date: 10/16/2017
Subject: Re: Soft Limits With Switches
Hi Tom,
I removed the #define RATE 1.1,#define MINTAU 0.12 and float NEWTAU from code.(Updated init program V4)
https://groups.yahoo.com/neo/groups/DynoMotion/files/HurcoMill1/

Used MPG to move axis back and forth without going into soft limit and all seems good. I did notice a little roughness at times, but i think this do to me spinning wheel a little faster than normal use, trying to get it to mess up. Which brings up a question....
Is there a way to set a default speed if hand wheel is spun to fast?

I also tested going into soft limits and there was no overshoot. Only tested it about a dozen times, but this is better than i had before. Axis still moves when spinning hand wheel a few times in opposite direction after soft limit is reached and then releasing feedhold. Its not a runaway, just the amount i spin hand wheel.

As for Accel,Jerk settings, i came up with those when i was doing my "acid test" g code program of short high speed moves. I was also adjusting settings in the Trajectory Planner in KMCNC. I eventually got tired of messing with it and this is where i left it. :}

Troy
Group: DynoMotion Message: 15100 From: tmday7 Date: 10/16/2017
Subject: Re: Soft Limits With Switches
Ok, did some more testing.
After several tests travel speed slows down when moving in minus direction causing the rough feed. After many tests like this the speed in minus direction would top out at about 150IPM and be rough. When going in plus direction i could hit about 300IPM smoothly.
So i went back to V3 of init code and speed in both directions is the same and smooth.

 Also i set my limit switch options back to Disallow Drive Into Limit when a limit switch is triggered which puts KMCNC into Estop condition, this also disables drives. If i spin hand wheel in opposite direction while in estop, and then try to clear estop, drive will fault out with a following error. So issue of MPG causing movement during feed hold with soft limits is not the complete scenario.

What is allowing motion commands to be accepted from MPG when in Estop and then execute these motions once estop is cleared?

Troy
Group: DynoMotion Message: 15101 From: mmurray70@hotmail.com Date: 10/16/2017
Subject: Re: Soft Limits With Switches
Im not really 100% sure why it worked, but it was also slow for me at first and after trying it this way it was much better. 

I like the idea of limiting Target position to soft limit position. That should work great and be foolproof. As it works for me now, the adjustsoftlimits is only helping with MPG movement, and this could easily be done with Toms method instead. 

Troy you need to fix the acceleration parameters. This is probably the first time you have actually ran at that acceleration level. When running G code it uses acceleration settings from Kmotioncnc and when running G0 commands the Jerk is limiting your accelleration. The moveExp function in the mpg code does not use jerk (i wish it did!) so its applying this extreme acceleration instantly and overloading servos. 
Group: DynoMotion Message: 15102 From: Tom Kerekes Date: 10/16/2017
Subject: Re: Soft Limits With Switches
Hi Troy,

KFLOP has 8 encoder inputs.  I believe you are only using 4 on JP7. 

The other 4 are accessible on either JP5 or JP6.

If you move Konnect from JP6 to JP4 those on JP6 should be usable.

HTH
Regards
TK

On 10/15/2017 4:13 PM, tmday88@... [DynoMotion] wrote:
 

My 4th encoder input is being used by the spindle encoder.

"Or the encoders could be mux'ed from JP5 to JP6 to allow 4 there on JP6 (change Konnect to JP4)"

Not sure i follow this. Are you saying doing this would add 4 more encoder inputs or just move the ones iam using now?Or?

Troy